Skip to content

Conversation

@aThorp96
Copy link
Member

@aThorp96 aThorp96 commented May 14, 2025

Changes

Skip running builds and tests on pull requests if the pull request only changes documentation. From what I can tell, there are no e2e tests in use right now triggered by the Tekton Integration workflow which analyze the markdown docs files except the codegen test which checks to ensure the Pipeline api file was updated, however that should only be updated if the pipelines api is changed in the code. The tests themselves take some time. Also, while the Workflows may be free for compute since they're on GHA, they are still unnecessary and if the e2e tests use any ancillary services which have cost (maybe caching, coverage, image hosting, etc) unnecessary runs at least have the potential of incurring cost.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label May 14, 2025
@tekton-robot tekton-robot requested review from dibyom and vdemeester May 14, 2025 07:15
@tekton-robot tekton-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 14, 2025
@aThorp96
Copy link
Member Author

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label May 14, 2025
@aThorp96
Copy link
Member Author

Note that the tests will still run on this PR since Github Actions only applies the rules from workflows as defined in the target branch.

on: [pull_request] # yamllint disable-line rule:truthy
on:
pull_request:
paths-ignore:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation for the paths-ignore configuration is here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good start I think

on:
pull_request:
paths-ignore:
- 'docs/**' # If the PR only modifies the documentation, there is no need to run builds and code tests
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option here which which would reduce the runs even more would be to instead use '**.md, since that would include things like README.md or roadmap.md. However I am not sure if that is too liberal a policy. There are a number of other markdown files in the repo for which changes may warrant running tests for reasons I am not privy to.

$ find . -name '*md' | rg -v ./vendor | rg -v ./docs
./.github/ISSUE_TEMPLATE/feature-request.md
./.github/ISSUE_TEMPLATE/free-form.md
./.github/ISSUE_TEMPLATE/promotion-request.md
./.github/ISSUE_TEMPLATE/bug-report.md
./.github/pull_request_template.md
./cmd
./cmd/entrypoint/README.md
./cmd/nop/README.md
./code-of-conduct.md
./examples/README.md
./hack/README.md
./tekton/README.md
./tekton/release-cheat-sheet.md
./test/custom-task-ctrls/wait-task-beta/README.md
./test/custom-task-ctrls/wait-task-beta/cmd
./test/resolver-with-timeout/README.md
./test/README.md
./topical-ownership.md
./CONTRIBUTING.md
./api_compatibility_policy.md
./roadmap.md
./DEVELOPMENT.md
./README.md
./releases.md

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think **md should be ok but depends on if any of the tests are testing the md files as you mentioned. Once we know that for sure we can use **md. +1 for the current defensive approach.

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think we have some checks on the docs (like deadlink) or we used to.
Out of curiosity, can we skip some jobs instead ? Worst case, we could have a "docs" workflow with the opposite filter.

@aThorp96
Copy link
Member Author

Yeah if there are docs CI tests we can use a separate filter. Do you know where the docs tests are found or called? I didn't see any inside this file, and outside of verify-codegen it looked like all the tests were unit tests

on: [pull_request] # yamllint disable-line rule:truthy
on:
pull_request:
paths-ignore:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good start I think

on:
pull_request:
paths-ignore:
- 'docs/**' # If the PR only modifies the documentation, there is no need to run builds and code tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think **md should be ok but depends on if any of the tests are testing the md files as you mentioned. Once we know that for sure we can use **md. +1 for the current defensive approach.

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 20, 2025
@vdemeester
Copy link
Member

/approve
/cc @AlanGreene @afrittoli

@tekton-robot
Copy link
Collaborator

@vdemeester: GitHub didn't allow me to request PR reviews from the following users: AlanGreene.

Note that only tektoncd members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/approve
/cc @AlanGreene @afrittoli

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot requested a review from afrittoli May 21, 2025 15:46
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a couple of yaml files under docs

➜ find docs -name '*yaml'
docs/resolver-template/config/demo-resolver-deployment.yaml
docs/resolver-template/test-resolver-template.yaml

Perhaps we could move the yaml linter under a dedicated job along with the markdown linter. Do we do markdown linting? I though we did but cannot find it....

on:
pull_request:
paths-ignore:
- 'docs/**' # If the PR only modifies the documentation, there is no need to run builds and code tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem I still see is that the skip here is for the entire set of jobs, and I think we should still run yamllint on the docs.

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 14, 2025
@waveywaves
Copy link
Member

waveywaves commented Aug 19, 2025

Hi @aThorp96, let me know if you have any updates on this one. This is a simple one so was hoping to get it merged soon.

@vdemeester
Copy link
Member

@aThorp96 needs a rebase 👼🏼

@vdemeester
Copy link
Member

We can carry this if need be.

@AlanGreene
Copy link
Member

AlanGreene commented Oct 3, 2025

I think this will block PRs since the jobs are still required.
There's an open GitHub enhancement request related to this: https://github.com/orgs/community/discussions/44490

The common approach is to skip the jobs using if instead, although it requires additional configuration to get the changed files.

Update: GitHub recommended approach: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks

Warning

If a workflow is skipped due to path filtering, branch filtering or a commit message, then checks associated with that workflow will remain in a "Pending" state. A pull request that requires those checks to be successful will be blocked from merging.

If, however, a job within a workflow is skipped due to a conditional, it will report its status as "Success". For more information, see Using conditions to control job execution.

When a job fails, any jobs that depend on the failed job are skipped and do not report a failure. A pull request that requires the check may not be blocked. To use a required check on a job that depends on other jobs, use the always() conditional expression in addition to needs, see Using jobs in a workflow.

@aThorp96 aThorp96 force-pushed the skip-build-tests-when-no-changes branch from bac9ec7 to f646f2b Compare October 4, 2025 18:41
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 4, 2025
@tekton-robot
Copy link
Collaborator

The following Tekton test failed:

Test name Commit Details Required Rerun command
pull-tekton-pipeline-go-coverage-df f646f2b link true /test pull-tekton-pipeline-go-coverage-df

@vdemeester
Copy link
Member

@aThorp96 can you take @AlanGreene's comment into account ?

@aThorp96
Copy link
Member Author

aThorp96 commented Oct 6, 2025

@AlanGreene Thanks for catching that. This should be trivial to do with an external action like dorny/paths-filter. I could write a step to do this with shell as well if we don't want to add an external action dependency. Any preference?

@afrittoli
Copy link
Member

@AlanGreene Thanks for catching that. This should be trivial to do with an external action like dorny/paths-filter. I could write a step to do this with shell as well if we don't want to add an external action dependency. Any preference?

I don't mind the external dependency, however the last commit on https://github.com/dorny/paths-filter was last year, which could be a red flag. Even if the action is in "problem solved" state, it should feature Dependabot updates or so. New PRs seem to have been ignored. Is there any other alternative?

@aThorp96 aThorp96 force-pushed the skip-build-tests-when-no-changes branch from f646f2b to 05be37a Compare October 6, 2025 18:19
@tekton-robot tekton-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 6, 2025
@aThorp96 aThorp96 force-pushed the skip-build-tests-when-no-changes branch 3 times, most recently from dbc097b to 9e111fa Compare October 6, 2025 19:05
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 6, 2025
@aThorp96 aThorp96 force-pushed the skip-build-tests-when-no-changes branch 3 times, most recently from 6beeb8a to 4b62a88 Compare October 8, 2025 13:20
on:
- pull_request
pull_request:
paths-ignore:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aThorp96 This should be removed then right ?

@aThorp96 aThorp96 force-pushed the skip-build-tests-when-no-changes branch 2 times, most recently from f786310 to f96ed24 Compare October 8, 2025 20:04
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester, waveywaves

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [vdemeester,waveywaves]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@aThorp96
Copy link
Member Author

aThorp96 commented Oct 8, 2025

Not ready to merge yet. Since I modified non-docs files (esp since I modified the build CI) it should have triggered a build.

@vdemeester
Copy link
Member

Ah it should have run a yamllint, but nothing more I guess, isn't it ? you changed the CI but to skip the CI..
Ah right, we should not skip a build if only the workflow are modified though, indeed.

/hold

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 9, 2025
only-new-issues: true
args: --timeout=10m
- name: yamllint
if: ${{ needs.changes.outputs.yaml == 'true' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, however I'm mostly concerned with E2E test. We should skip them if they're not relevant as they take a lot of runners and time. Everything else is small/quick enough that I would not bother touching it at the risk of over-optimising.

@aThorp96 aThorp96 force-pushed the skip-build-tests-when-no-changes branch from f96ed24 to 2187710 Compare October 9, 2025 13:04
@aThorp96
Copy link
Member Author

aThorp96 commented Oct 9, 2025

@vdemeester @afrittoli This appears to be working as expected now.

@aThorp96 aThorp96 force-pushed the skip-build-tests-when-no-changes branch from 2187710 to f8fdb02 Compare October 9, 2025 13:13
@aThorp96 aThorp96 force-pushed the skip-build-tests-when-no-changes branch from f8fdb02 to fe9b6b2 Compare October 9, 2025 13:17
Comment on lines +25 to +27
- name: Get base depth
id: base-depth
run: echo "base-depth=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_OUTPUT
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could clone the full repository here, but that could take some time and is probably not necessary. This should help the pre-check go much quicker

@afrittoli
Copy link
Member

/retest

@aThorp96 aThorp96 force-pushed the skip-build-tests-when-no-changes branch from fe9b6b2 to a097c84 Compare October 20, 2025 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/misc Categorizes issue or PR as a miscellaneuous one. release-note-none Denotes a PR that doesnt merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

6 participants